<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template segment_manager</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../interprocess/indexes_reference.html#header.boost.interprocess.segment_manager_hpp" title="Header &lt;boost/interprocess/segment_manager.hpp&gt;">
<link rel="prev" href="permissions.html" title="Class permissions">
<link rel="next" href="segment_manager/allocator.html" title="Struct template allocator">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="permissions.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.segment_manager_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="segment_manager/allocator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.interprocess.segment_manager"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template segment_manager</span></h2>
<p>boost::interprocess::segment_manager</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../interprocess/indexes_reference.html#header.boost.interprocess.segment_manager_hpp" title="Header &lt;boost/interprocess/segment_manager.hpp&gt;">boost/interprocess/segment_manager.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharType<span class="special">,</span> <span class="keyword">typename</span> MemoryAlgorithm<span class="special">,</span> 
         <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">IndexConfig</span> <span class="special">&gt;</span> <span class="keyword">class</span> IndexType<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="segment_manager.html" title="Class template segment_manager">segment_manager</a> <span class="special">:</span>
  <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">interprocess</span><span class="special">::</span><span class="identifier">segment_manager_base</span><span class="special">&lt;</span> <span class="identifier">MemoryAlgorithm</span> <span class="special">&gt;</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">MemoryAlgorithm</span>                                                                 <a name="boost.interprocess.segment_manager.memory_algorithm"></a><span class="identifier">memory_algorithm</span><span class="special">;</span>         
  <span class="keyword">typedef</span> <span class="identifier">segment_manager_base_t</span><span class="special">::</span><span class="identifier">void_pointer</span>                                            <a name="boost.interprocess.segment_manager.void_pointer"></a><span class="identifier">void_pointer</span><span class="special">;</span>             
  <span class="keyword">typedef</span> <span class="identifier">segment_manager_base_t</span><span class="special">::</span><span class="identifier">size_type</span>                                               <a name="boost.interprocess.segment_manager.size_type"></a><span class="identifier">size_type</span><span class="special">;</span>                
  <span class="keyword">typedef</span> <span class="identifier">segment_manager_base_t</span><span class="special">::</span><span class="identifier">difference_type</span>                                         <a name="boost.interprocess.segment_manager.difference_type"></a><span class="identifier">difference_type</span><span class="special">;</span>          
  <span class="keyword">typedef</span> <span class="identifier">CharType</span>                                                                        <a name="boost.interprocess.segment_manager.char_type"></a><span class="identifier">char_type</span><span class="special">;</span>                
  <span class="keyword">typedef</span> <a class="link" href="segment_manager_base.html" title="Class template segment_manager_base">segment_manager_base</a><span class="special">&lt;</span> <span class="identifier">MemoryAlgorithm</span> <span class="special">&gt;</span>                                         <a name="boost.interprocess.segment_manager.segment_manager_base_type"></a><span class="identifier">segment_manager_base_type</span><span class="special">;</span>
  <span class="keyword">typedef</span> <span class="identifier">segment_manager_base_t</span><span class="special">::</span><span class="identifier">mutex_family</span>                                            <a name="boost.interprocess.segment_manager.mutex_family"></a><span class="identifier">mutex_family</span><span class="special">;</span>             
  <span class="keyword">typedef</span> <span class="identifier">transform_iterator</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">named_index_t</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">named_transform</span> <span class="special">&gt;</span>   <a name="boost.interprocess.segment_manager.const_named_iterator"></a><span class="identifier">const_named_iterator</span><span class="special">;</span>     
  <span class="keyword">typedef</span> <span class="identifier">transform_iterator</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">unique_index_t</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">unique_transform</span> <span class="special">&gt;</span> <a name="boost.interprocess.segment_manager.const_unique_iterator"></a><span class="identifier">const_unique_iterator</span><span class="special">;</span>    

  <span class="comment">// member classes/structs/unions</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="segment_manager/allocator.html" title="Struct template allocator">allocator</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <a class="link" href="allocator.html" title="Class template allocator">boost::interprocess::allocator</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <a class="link" href="segment_manager.html" title="Class template segment_manager">segment_manager</a> <span class="special">&gt;</span> <a class="link" href="segment_manager/allocator.html#boost.interprocess.segment_manager.allocator.type"><span class="identifier">type</span></a><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="keyword">struct</span> <a class="link" href="segment_manager/deleter.html" title="Struct template deleter">deleter</a> <span class="special">{</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <a class="link" href="deleter.html" title="Class template deleter">boost::interprocess::deleter</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <a class="link" href="segment_manager.html" title="Class template segment_manager">segment_manager</a> <span class="special">&gt;</span> <a class="link" href="segment_manager/deleter.html#boost.interprocess.segment_manager.deleter.type"><span class="identifier">type</span></a><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="segment_manager.html#boost.interprocess.segment_managerconstruct-copy-destruct">construct/copy/destruct</a></span>
  <span class="keyword">explicit</span> <a class="link" href="../container/basic_string.html#idm28637-bb"><span class="identifier">segment_manager</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="segment_manager.html#idm28460-bb">public member functions</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&gt;</span> <a class="link" href="../container/basic_string.html#idm28461-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&gt;</span> <a class="link" href="segment_manager.html#idm28469-bb"><span class="identifier">find_no_lock</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28477-bb"><span class="identifier">construct</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28485-bb"><span class="identifier">find_or_construct</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
    <a class="link" href="segment_manager.html#idm28493-bb"><span class="identifier">construct</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
    <a class="link" href="segment_manager.html#idm28503-bb"><span class="identifier">find_or_construct</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28513-bb"><span class="identifier">construct_it</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28520-bb"><span class="identifier">find_or_construct_it</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
    <a class="link" href="segment_manager.html#idm28528-bb"><span class="identifier">construct_it</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
    <a class="link" href="segment_manager.html#idm28538-bb"><span class="identifier">find_or_construct_it</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Func<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="segment_manager.html#idm28548-bb"><span class="identifier">atomic_func</span></a><span class="special">(</span><span class="identifier">Func</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Func<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="segment_manager.html#idm28557-bb"><span class="identifier">try_atomic_func</span></a><span class="special">(</span><span class="identifier">Func</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="segment_manager.html#idm28565-bb"><span class="identifier">destroy</span></a><span class="special">(</span><span class="identifier">char_ptr_holder_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="segment_manager.html#idm28573-bb"><span class="identifier">destroy_ptr</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="segment_manager.html#idm28581-bb"><span class="identifier">reserve_named_objects</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="segment_manager.html#idm28588-bb"><span class="identifier">reserve_unique_objects</span></a><span class="special">(</span><span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="segment_manager.html#idm28595-bb"><span class="identifier">shrink_to_fit_indexes</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">size_type</span> <a class="link" href="segment_manager.html#idm28599-bb"><span class="identifier">get_num_named_objects</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">size_type</span> <a class="link" href="segment_manager.html#idm28603-bb"><span class="identifier">get_num_unique_objects</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">const_named_iterator</span> <a class="link" href="segment_manager.html#idm28607-bb"><span class="identifier">named_begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_named_iterator</span> <a class="link" href="segment_manager.html#idm28611-bb"><span class="identifier">named_end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_unique_iterator</span> <a class="link" href="segment_manager.html#idm28615-bb"><span class="identifier">unique_begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_unique_iterator</span> <a class="link" href="segment_manager.html#idm28619-bb"><span class="identifier">unique_end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="allocator.html" title="Class template allocator">allocator</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28623-bb"><span class="identifier">get_allocator</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="segment_manager/deleter.html" title="Struct template deleter">deleter</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="segment_manager.html#idm28630-bb"><span class="identifier">get_deleter</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="segment_manager.html#idm28642-bb">public static functions</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">CharType</span> <span class="special">*</span> <a class="link" href="segment_manager.html#idm28643-bb"><span class="identifier">get_instance_name</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">size_type</span> <a class="link" href="segment_manager.html#idm28651-bb"><span class="identifier">get_instance_length</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">instance_type</span> <a class="link" href="segment_manager.html#idm28659-bb"><span class="identifier">get_instance_type</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">static</span> <span class="identifier">size_type</span> <a class="link" href="../container/basic_string.html#idm28667-bb"><span class="identifier">get_min_size</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// public data members</span>
  <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">size_type</span> <span class="identifier">PayloadPerAllocation</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.17.17.3.45.4.4"></a><h2>Description</h2>
<p>This object is placed in the beginning of memory segment and implements the allocation (named or anonymous) of portions of the segment. This object contains two indexes that maintain an association between a name and a portion of the segment.</p>
<p>The first index contains the mappings for normal named objects using the char type specified in the template parameter.</p>
<p>The second index contains the association for unique instances. The key will be the const char * returned from type_info.name() function for the unique type to be constructed.</p>
<p>segment_manager&lt;CharType, MemoryAlgorithm, IndexType&gt; inherits publicly from segment_manager_base&lt;MemoryAlgorithm&gt; and inherits from it many public functions related to anonymous object and raw memory allocation. See <a class="link" href="segment_manager_base.html" title="Class template segment_manager_base">segment_manager_base</a> reference to know about those functions. </p>
<div class="refsect2">
<a name="id-1.3.17.17.3.45.4.4.6"></a><h3>
<a name="boost.interprocess.segment_managerconstruct-copy-destruct"></a><code class="computeroutput">segment_manager</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="idm28637-bb"></a><span class="identifier">segment_manager</span><span class="special">(</span><span class="identifier">size_type</span> segment_size<span class="special">)</span><span class="special">;</span></pre>
<p>Constructor of the segment manager "size" is the size of the memory segment where the segment manager is being constructed. Can throw </p>
</li></ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.17.17.3.45.4.4.7"></a><h3>
<a name="idm28460-bb"></a><code class="computeroutput">segment_manager</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&gt;</span> <a name="idm28461-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Tries to find a previous named/unique allocation. Returns the address and the object count. On failure the first member of the returned pair is 0. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&gt;</span> <a name="idm28469-bb"></a><span class="identifier">find_no_lock</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Tries to find a previous named/unique allocation. Returns the address and the object count. On failure the first member of the returned pair is 0. This search is not mutex-protected! Use it only inside atomic_func() calls, where the internal mutex is guaranteed to be locked. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28477-bb"></a><span class="identifier">construct</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Returns throwing "construct" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28485-bb"></a><span class="identifier">find_or_construct</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Returns throwing "search or construct" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
  <a name="idm28493-bb"></a><span class="identifier">construct</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns no throwing "construct" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
  <a name="idm28503-bb"></a><span class="identifier">find_or_construct</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns no throwing "search or construct" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28513-bb"></a><span class="identifier">construct_it</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>Returns throwing "construct from iterators" proxy object. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28520-bb"></a><span class="identifier">find_or_construct_it</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Returns throwing "search or construct from iterators" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
  <a name="idm28528-bb"></a><span class="identifier">construct_it</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns no throwing "construct from iterators" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="identifier">construct_iter_proxy</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
  <a name="idm28538-bb"></a><span class="identifier">find_or_construct_it</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">nothrow_t</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns no throwing "search or construct from iterators" proxy object </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Func<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm28548-bb"></a><span class="identifier">atomic_func</span><span class="special">(</span><span class="identifier">Func</span> <span class="special">&amp;</span> f<span class="special">)</span><span class="special">;</span></pre>
<p>Calls object function blocking recursive <code class="computeroutput"><a class="link" href="interprocess_mutex.html" title="Class interprocess_mutex">interprocess_mutex</a></code> and guarantees that no new named_alloc or destroy will be executed by any process while executing the object function call </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Func<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idm28557-bb"></a><span class="identifier">try_atomic_func</span><span class="special">(</span><span class="identifier">Func</span> <span class="special">&amp;</span> f<span class="special">)</span><span class="special">;</span></pre>
<p>Tries to calls a functor guaranteeing that no new construction, search or destruction will be executed by any process while executing the object function call. If the atomic function can't be immediatelly executed because the internal mutex is already locked, returns false. If the functor throws, this function throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idm28565-bb"></a><span class="identifier">destroy</span><span class="special">(</span><span class="identifier">char_ptr_holder_t</span> name<span class="special">)</span><span class="special">;</span></pre>
<p>Destroys a previously created named/unique instance. Returns false if the object was not present. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm28573-bb"></a><span class="identifier">destroy_ptr</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span> p<span class="special">)</span><span class="special">;</span></pre>
<p>Destroys an anonymous, unique or named object using its address </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm28581-bb"></a><span class="identifier">reserve_named_objects</span><span class="special">(</span><span class="identifier">size_type</span> num<span class="special">)</span><span class="special">;</span></pre>
<p>Preallocates needed index resources to optimize the creation of "num" named objects in the managed memory segment. Can throw <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> if there is no enough memory. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm28588-bb"></a><span class="identifier">reserve_unique_objects</span><span class="special">(</span><span class="identifier">size_type</span> num<span class="special">)</span><span class="special">;</span></pre>
<p>Preallocates needed index resources to optimize the creation of "num" unique objects in the managed memory segment. Can throw <code class="computeroutput"><a class="link" href="bad_alloc.html" title="Class bad_alloc">boost::interprocess::bad_alloc</a></code> if there is no enough memory. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm28595-bb"></a><span class="identifier">shrink_to_fit_indexes</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Calls shrink_to_fit in both named and unique object indexes to try to free unused memory from those indexes. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_type</span> <a name="idm28599-bb"></a><span class="identifier">get_num_named_objects</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns the number of named objects stored in the segment. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">size_type</span> <a name="idm28603-bb"></a><span class="identifier">get_num_unique_objects</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns the number of unique objects stored in the segment. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_named_iterator</span> <a name="idm28607-bb"></a><span class="identifier">named_begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a constant iterator to the beginning of the information about the named allocations performed in this segment manager </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_named_iterator</span> <a name="idm28611-bb"></a><span class="identifier">named_end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a constant iterator to the end of the information about the named allocations performed in this segment manager </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_unique_iterator</span> <a name="idm28615-bb"></a><span class="identifier">unique_begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a constant iterator to the beginning of the information about the unique allocations performed in this segment manager </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_unique_iterator</span> <a name="idm28619-bb"></a><span class="identifier">unique_end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a constant iterator to the end of the information about the unique allocations performed in this segment manager </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="allocator.html" title="Class template allocator">allocator</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28623-bb"></a><span class="identifier">get_allocator</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns an instance of the default allocator for type T initialized that allocates memory from this segment manager. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="segment_manager/deleter.html" title="Struct template deleter">deleter</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm28630-bb"></a><span class="identifier">get_deleter</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns an instance of the default deleter for type T that will delete an object constructed in this segment manager. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.17.17.3.45.4.4.8"></a><h3>
<a name="idm28642-bb"></a><code class="computeroutput">segment_manager</code> public static functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">CharType</span> <span class="special">*</span> <a name="idm28643-bb"></a><span class="identifier">get_instance_name</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span> ptr<span class="special">)</span><span class="special">;</span></pre>
<p>Returns the name of an object created with construct/find_or_construct functions. Does not throw </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">size_type</span> <a name="idm28651-bb"></a><span class="identifier">get_instance_length</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span> ptr<span class="special">)</span><span class="special">;</span></pre>
<p>Returns the length of an object created with construct/find_or_construct functions. Does not throw. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">instance_type</span> <a name="idm28659-bb"></a><span class="identifier">get_instance_type</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">*</span> ptr<span class="special">)</span><span class="special">;</span></pre>
<p>Returns is the the name of an object created with construct/find_or_construct functions. Does not throw </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">size_type</span> <a name="idm28667-bb"></a><span class="identifier">get_min_size</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Obtains the minimum size needed by the segment manager </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2005-2015 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="permissions.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.segment_manager_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="segment_manager/allocator.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
